home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CONTRSRC.ZIP / SRC / TYPEONE / SNUL.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-11-04  |  9.3 KB  |  363 lines

  1.  
  2. ;****************************************************
  3. ; PLUS OU MOINS NET (C) 1994 Type One / TFL-TDV Prod.
  4. ;****************************************************
  5.  
  6. INCLUDE PDFIK.INC ; DataFile Manager
  7. INCLUDE VIDEO.INC ; Flamoot VGA SetUp
  8. INCLUDE PLAYINFO.INC ; Player structures
  9. INCLUDE KEYBOARD.INC ; Keyboard macros
  10.  
  11. ;-----------------------------------------
  12. ; Déclaration modèle mémoire
  13. .386
  14. DGROUP GROUP _DATA,_BSS
  15. SNUL_TEXT  SEGMENT DWORD PUBLIC USE16 'CODE'
  16.           ASSUME CS:SNUL_TEXT,DS:DGROUP
  17. SNUL_TEXT  ENDS
  18. _DATA  SEGMENT DWORD PUBLIC USE16 'DATA'
  19. _DATA  ENDS
  20. _BSS   SEGMENT DWORD PUBLIC USE16 'BSS'
  21. _BSS   ENDS
  22. ;-----------------------------------------
  23.  
  24. _DATA SEGMENT  
  25.  
  26. ;-- donnees pattern --
  27. EXTRN _Datafile  : BYTE
  28. EXTRN _OfsinDta  : DWORD
  29. Picname   BYTE 'snuls.raw',0
  30. Picparam  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Picname,0,0,0,,,0>
  31.  
  32. EXTRN _Expo : WORD
  33. EXTRN _ExpoEnd : WORD
  34.  
  35. _DATA ENDS
  36.  
  37. ; données non initialisées !!!
  38. _BSS SEGMENT
  39.  
  40. EXTRN _FrameCounter     : WORD
  41. EXTRN _StartAdr         : WORD
  42. EXTRN _WorkAdr          : WORD
  43. EXTRN _NextAdr          : WORD
  44. EXTRN _Triple           : WORD
  45. EXTRN _SyncFlag         : WORD
  46. EXTRN _ShiftOfs         : WORD
  47. ;!!!!!!!!!! synchro avec music !!!!!!!!!!!!
  48. EXTRN _MP               : DWORD ; extern ModulePlayer * MB
  49. EXTRN _ReplayInfo       : mpInformation
  50.  
  51. ;---- param pour synchro avec zizik ----
  52. EVEN
  53. DebSong  WORD ?
  54. FinSong  WORD ?
  55.  
  56. EVEN
  57. PicSeg   WORD ?        ; ptr vers segment pattern
  58. Timeleft WORD ?        ; temps restant pour execution
  59.  
  60. Sens     WORD ?        ; expo direction !!!
  61. WaitABit WORD ?        ; pause flag
  62.  
  63. _BSS ENDS 
  64.  
  65. SNUL_TEXT SEGMENT
  66.      PUBLIC _StartSnul
  67.  
  68.  
  69. ; Point d'entrée de l'intro !!!!!
  70. ;---------------------------------
  71. ALIGN
  72. EVEN
  73. _StartSnul PROC FAR
  74.  
  75.          push    bp                  ; bâtit le cadre de pile
  76.          mov     bp,sp
  77.          
  78.          pushad
  79.          MPUSH ds,es,fs,gs
  80.  
  81.          STARTUP         
  82. ;------- recuperer parametres sur le stack !!!! --------
  83.  
  84.          mov     ax,WORD PTR ss:[bp+6]  ; debut pos
  85.          shl     eax,14        
  86.          or      ax,WORD PTR ss:[bp+8]  ; debut row
  87.          or      ah,al
  88.          shr     eax,8
  89.          mov     DebSong,ax
  90.          mov     ax,WORD PTR ss:[bp+10] ; fin pos
  91.          shl     eax,14 
  92.          or      ax,WORD PTR ss:[bp+12] ; fin row
  93.          or      ah,al
  94.          shr     eax,8
  95.          mov     FinSong,ax
  96.          xor     eax,eax
  97. ;-------------------------------------------------------
  98.  
  99.          push    m320x400x256p
  100.          call    _SetVGA
  101.          add     sp,2 
  102.  
  103.          STARTUP
  104. ;--------------------------------------
  105.          call    Snul                ; !!!!! Snul part !!!!!
  106. ;--------------------------------------
  107.  
  108.          mov  ax,0a000h              ; clear screen
  109.          mov  es,ax
  110.          xor  eax,eax
  111.          xor  di,di
  112.          mov  cx,65536/4
  113.          rep  stosd
  114.  
  115.          mov  _ShiftOfs,0            ; don't shift !!!!
  116.  
  117.          MPOP ds,es,fs,gs
  118.          popad
  119.          nop
  120.  
  121.          leave                             ; restore stack
  122.                                            ; mov sp,bp + pop bp
  123.          retf                              ; C/C++ retirera le param 
  124.  
  125. _StartSnul ENDP
  126.  
  127.  
  128. ;==============================================================================
  129. ;=============================== Snul part ====================================
  130. ;==============================================================================
  131.  
  132. ALIGN
  133. EVEN
  134. Snul PROC NEAR
  135.  
  136. ;------------------------------------------------------------------------------
  137.          pushad
  138.  
  139.          mov     eax,_OfsinDta         ; OFFSET in Datafile
  140.          mov     Picparam.OfsInPdf,eax
  141.          mov     ax,DGROUP             ; prepare for PDFIK call 
  142.          mov     es,ax 
  143.          mov     bx,OFFSET Picparam  
  144.          pusha 
  145.          call    PDFIK_ASM             ; call function 2 (extract+alloc)
  146.          popa
  147.          mov     ax,Picparam.BufSeg ; where is the file in mem ?  
  148.          mov     Picseg,ax
  149.  
  150.          push    ds
  151.          push    es
  152.          mov     ax,Picseg
  153.          mov     ds,ax                 ; 32 bytes for Alchemy Header
  154.          mov     si,32                 ; palette offset 
  155.          mov     es,ax
  156.          mov     di,32
  157.  
  158.          mov     cx,768                ; 256*3 components
  159. @@:      lodsb
  160.          shr     al,2                  ; 8 to 6 bits conversion
  161.          stosb
  162.          dec     cx
  163.          jnz     @B
  164.  
  165.          mov     ax,1012h              ; Set Palet
  166.          xor     bx,bx
  167.          mov     dx,32
  168.          mov     cx,256
  169.          int     10h
  170.  
  171.          pop     es
  172.          pop     ds
  173.  
  174.  
  175. ;--------------------------------------------------
  176.  
  177.  
  178. ;---- wait right position/row in tune ----
  179.  
  180. WaitPos: 
  181.          mov     _ReplayInfo.numChannels,4 ; 4 voices
  182.          
  183.          les     bx,DWORD PTR[_MP]
  184.          push    ds
  185.          push    OFFSET _ReplayInfo
  186.  
  187.          ; _MP->GetInformation(&ReplayInfo)
  188.  
  189.          call    (ModulePlayer PTR es:[bx]).GetInformation
  190.          add     sp,4
  191.  
  192.          mov     ax,_ReplayInfo.pos
  193.          shl     eax,14
  194.          or      ax,_ReplayInfo.row
  195.          or      ah,al
  196.          shr     eax,8
  197.          cmp     ax,WORD PTR[DebSong]   ; is it time ????
  198.          jb      WaitPos
  199.  
  200.          xor     eax,eax   
  201.  
  202. ;------------------------------------------
  203.  
  204.          mov     bx,_StartAdr
  205.          mov     WORD PTR[bx],0         ; _StartAdr->base = 0
  206.          mov     WORD PTR[bx+2],0       ; _StartAdr->flag = false
  207.          mov     bx,_WorkAdr
  208.          mov     WORD PTR[bx],0         ; _WorkAdr->base
  209.          mov     WORD PTR[bx+2],0       ; _WorkAdr->flag = false
  210.          mov     _Triple,0
  211.          VSYNC
  212.  
  213.  
  214. ;--------------- Put pic in Vid Mem ---------------
  215.          push    ds
  216.          push    es
  217.          mov     ax,PicSeg
  218.          add     ax,(768+32) SHR 4
  219.          mov     ds,ax
  220.          mov     ax,0a000h
  221.          mov     es,ax
  222.          xor     si,si
  223.          mov     dx,3c4h
  224.          mov     al,2
  225.          out     dx,al
  226.          inc     dl
  227.          i = 0
  228.          REPT    4
  229.          mov     al,(1 SHL i)
  230.          out     dx,al
  231.          mov     di,320*400/4
  232.          mov     cx,65536/4
  233. @@:      lodsb
  234.          add     si,3
  235.          stosb
  236.          dec     cx
  237.          jnz     @B
  238.          sub     si,65536-1
  239.          i=i+1
  240.          ENDM
  241.          mov     bp,di
  242.          inc     bp
  243.          mov     ax,ds
  244.          add     ax,65536 SHR 4
  245.          mov     ds,ax
  246.          i=0
  247.          REPT    4
  248.          mov     al,(1 SHL i)
  249.          out     dx,al
  250.          mov     di,bp
  251.          mov     cx,(320*400-65536)/4
  252. @@:      lodsb
  253.          add     si,3
  254.          stosb
  255.          dec     cx
  256.          jnz     @B
  257.          sub     si,(320*400-65536)-1
  258.          i=i+1
  259.          ENDM
  260.  
  261.          pop     es
  262.          pop     ds
  263.  
  264.  
  265. ;---------------
  266.  
  267.          STARTUP
  268.  
  269.          mov     si,OFFSET _Expo        ; exponential curve
  270.          mov     Sens,0
  271.          mov     WaitABit,0             ; no wait by default !!!
  272.  
  273.          EVEN
  274. Main: ; -= VSYNC =-
  275.          mov     ax,_FrameCounter
  276.          test    ax,ax
  277.          jz      Main
  278.  
  279. ;----------- test if we must finish ... ----------
  280.          mov     ax,_FrameCounter
  281.          mov     _FrameCounter,0 ; set counter to NULL
  282.  
  283.          mov     _ReplayInfo.numChannels,4 ; 4 voices
  284.          
  285.          les     bx,DWORD PTR[_MP]
  286.          push    ds
  287.          push    OFFSET _ReplayInfo
  288.  
  289.          ; _MP->GetInformation(&ReplayInfo)
  290.  
  291.          call    (ModulePlayer PTR es:[bx]).GetInformation
  292.          add     sp,4
  293.  
  294.          mov     ax,_ReplayInfo.pos
  295.          shl     eax,14
  296.          or      ax,_ReplayInfo.row
  297.          or      ah,al
  298.          shr     eax,8
  299.          cmp     ax,WORD PTR[FinSong]    ; is it time ????
  300.          jb      @F 
  301.        ; jae     GoOut                   ; quitter si on doit !!!!!
  302.          mov     WaitABit,0              ; force exit !!!!
  303. @@:
  304.          xor     eax,eax
  305. ;--------------------------------------------------------------------
  306.  
  307.          SHOWTIME 32
  308.  
  309. ;**************** Scroll the pic *****************
  310.          cmp     si,OFFSET _ExpoEnd
  311.          jne     @F
  312.          cmp     Sens,1       ; if 2 directions yet  
  313.          je      GoOut        ; Go away !!!!!
  314.          mov     si,OFFSET _Expo
  315.          mov     Sens,1       ; change direction
  316.          mov     WaitABit,70*3; wait 3 sec
  317.        
  318. @@:      cmp     WaitABit,0   ; No wait ????
  319.          je      @F
  320. ;         dec     WaitABit     ; --
  321.          jmp     SkipDis
  322. @@:      lodsw                ; load next coord
  323.          cmp     Sens,0
  324.          je      @F
  325.          sub     ax,400       ; invert curve
  326.          neg     ax
  327. @@:      mov     dx,80
  328.          mul     dx           ; aaaaarghh a mul !!!! horror !!!!
  329.          mov     _ShiftOfs,ax
  330. SkipDis:
  331. ;**************************************************
  332.  
  333.          SHOWTIME 0
  334.  
  335.          LOOP_UNTIL_KEY Main
  336.  
  337. GoOut:
  338.  
  339.         FLUSH_KEYBUF                  ; Flush keyboard buffer !!! ;-)
  340.  
  341. ;----- EXIT -----
  342.  
  343.         STARTUP
  344.         mov     ax,Picseg             ; segment to free
  345.         mov     es,ax
  346.         mov     ah,49h                ; MFREE
  347.         int     21h
  348.  
  349.         popad
  350.         nop
  351.         ret
  352.  
  353. Snul ENDP
  354.  
  355. ;==============================================================================
  356.  
  357. SNUL_TEXT ENDS
  358.  
  359.      END
  360.  
  361.  
  362.  
  363.